package comxin.stringtest;

import org.junit.Test;

public class StringDemo4 {
    public static void main(String[] args) {
        String s = new String("zhangxin");
        System.out.println(s);

    }
    @Test
    public void method1(){
        String s1 = new String("zhangxin");
//        System.out.println(s);\
        String s2 = new String("zhangxin");
//        System.out.println(s1==s2);
        System.out.println(s1.equals(s2));
    }
    @Test
    public void method2(){
        String s1="zhangxin";
        String s2="zhangxin";
        System.out.println(s1==s2);
        System.out.println(s1.equals(s2));
    }
    @Test
    public void method3(){

//        StringBuffer s1 = new StringBuffer("woxihuan");
//        String s = s1.toString();
//        System.out.println();
//        System.out.println(s1);
        String string=new String("abc");
//        System.out.println(string);
        StringBuffer stringBuffer = new StringBuffer(string);
        System.out.println(stringBuffer);
         stringBuffer.append("d");
        System.out.println(stringBuffer);

    }
}
